<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Task3</title>
  </head>
  <body>
    <script>
      function isEmpty(str) {
        if (!str.trim().length) {
          return true
        }
        return false
      }

      function temperatureBodyDetection(success, fail) {
        let temperature = ''

        do {
          temperature = window.prompt('请输入输入您的体温,数字')
        } while (isEmpty(temperature) || isNaN(temperature))

        if (temperature >= 36 && temperature <= 38) {
          success() /*执行成功函数*/
          return
        }

        fail() /*执行失败函数*/
        return
      }

      /* finish the function expression */
      var success = () => {
        document.write('体温正常，打卡成功')
      }
      /* finish the function expression */
      var fail = () => {
        document.write('体温异常，打卡失败!')
      }
      /**调用打卡函数**/
      temperatureBodyDetection(success, fail)
    </script>
  </body>
</html>
